import requests
import sqlite3
from lxml import etree

response = requests.get("https://www.xiaoshuopu.com/")
content = response.text
tree = etree.HTML(content)
category = tree.cssselect(".m_menu ul li a")
category_datas = [cg.text for cg in category][1:11]
category_datas = list(zip(category_datas))
print(category_datas)

con = sqlite3.connect("../mysite/db.sqlite3")
cur = con.cursor()
cur.executemany('insert into main_category (name) values (?)', category_datas)

con.commit()
cur.close()
con.close()
